#include <myheader.h>
    char*port="8080";
    char *ip="192.168.74.128";
/* Usage:  */
int main(int argc, char *argv[]){                                  
    //创建客户端socket
    int socket_fd=socket(AF_INET,SOCK_STREAM,0);
    //定义服务器的地址
    struct sockaddr_in sock;
    sock.sin_port=htons(atoi(port));
    sock.sin_family=AF_INET;
    sock.sin_addr.s_addr=inet_addr(ip);
    //发起连接
    int ret=connect(socket_fd,(struct sockaddr*)&sock,sizeof(sock));
    
    ERROR_CHECK(ret,-1,"connect");
    
    
    while(1){
    //读取标准输入的数据发送到socket_fd
    char buf[100]={0};
    read(0,buf,sizeof(buf));
    send(socket_fd,buf,sizeof(buf),0);
    //清空buf,接收socket_fd发送来的数据
    bzero(buf,sizeof(buf));
    ssize_t ret=recv(socket_fd,buf,sizeof(buf),0);
    if(ret==0){
        break;
    }
    printf("buf:%s\n",buf);
    }
        
    
    
    
    

}

